package com.zonesion.robot.ai;

import android.app.Application;
import android.content.Context;
import android.util.Log;

public class TheApplication extends Application {

    private static Context context;

    private static TheApplication instance;

    @Override
    public void onCreate() {
        super.onCreate();
        if (instance == null) {
            instance = this;
        }
        //得到一个应用级别的Context
        context = getApplicationContext();
    }

    /**
     * <p>
     * 获取BaseApplication实例
     * <p>
     * 单例模式，返回唯一实例
     *
     * @return instance
     */
    public static TheApplication getInstance() {
        return instance;
    }


    public static Context getContext(){
        return context;
    }

    @Override
    public void onTerminate() {
        Log.i("TheApplication", "onTerminate");
        super.onTerminate();
    }
}
